// 工具类样式

// 浮动清除
.clearfix {
  @include clearfix;
}

// 文本省略
.ellipsis {
  @include ellipsis;
}

.ellipsis-2 {
  @include ellipsis-lines(2);
}

.ellipsis-3 {
  @include ellipsis-lines(3);
}

// 居中
.center {
  @include center;
}

.absolute-center {
  @include absolute-center;
}

// 卡片样式
.card {
  @include card;
}

// 滚动条
.custom-scrollbar {
  @include scrollbar;
}

.thin-scrollbar {
  @include scrollbar(4px);
}

.no-scrollbar {
  &::-webkit-scrollbar {
    display: none;
  }
  
  scrollbar-width: none;
  -ms-overflow-style: none;
}

// 加载状态
.loading {
  @include loading;
}

// 禁用状态
.disabled {
  @include disabled;
}

// 主题渐变
.primary-gradient {
  @include primary-gradient;
}

// 动画
.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

.fade-out {
  animation: fadeOut 0.3s ease-in-out;
}

.slide-in-left {
  animation: slideInLeft 0.3s ease-in-out;
}

.slide-in-right {
  animation: slideInRight 0.3s ease-in-out;
}

.slide-in-top {
  animation: slideInTop 0.3s ease-in-out;
}

.slide-in-bottom {
  animation: slideInBottom 0.3s ease-in-out;
}

.zoom-in {
  animation: zoomIn 0.3s ease-in-out;
}

.zoom-out {
  animation: zoomOut 0.3s ease-in-out;
}

.bounce-in {
  animation: bounceIn 0.6s ease-in-out;
}

.rotate {
  animation: rotate 1s linear infinite;
}

.pulse {
  animation: pulse 2s infinite;
}

// 动画关键帧
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes zoomOut {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.8);
    opacity: 0;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

// 状态指示器
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  
  &.success {
    background-color: var(--kexilo-success);
  }
  
  &.warning {
    background-color: var(--kexilo-warning);
  }
  
  &.danger {
    background-color: var(--kexilo-danger);
  }
  
  &.info {
    background-color: var(--kexilo-info);
  }
  
  &.primary {
    background-color: var(--kexilo-primary);
  }
}

// 徽章
.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  border-radius: 10px;
  
  &.badge-primary {
    color: white;
    background-color: var(--kexilo-primary);
  }
  
  &.badge-success {
    color: white;
    background-color: var(--kexilo-success);
  }
  
  &.badge-warning {
    color: white;
    background-color: var(--kexilo-warning);
  }
  
  &.badge-danger {
    color: white;
    background-color: var(--kexilo-danger);
  }
  
  &.badge-info {
    color: white;
    background-color: var(--kexilo-info);
  }
  
  &.badge-light {
    color: var(--kexilo-text-color-primary);
    background-color: var(--kexilo-fill-color-light);
    border: 1px solid var(--kexilo-border-color-light);
  }
}

// 分割线
.divider {
  height: 1px;
  background-color: var(--kexilo-border-color-lighter);
  margin: 16px 0;
  
  &.divider-vertical {
    width: 1px;
    height: auto;
    margin: 0 16px;
  }
  
  &.divider-dashed {
    border-top: 1px dashed var(--kexilo-border-color-lighter);
    background: none;
  }
}

// 高亮文本
.highlight {
  background-color: yellow;
  padding: 0 2px;
}

.highlight-primary {
  background-color: var(--kexilo-primary-light-9);
  color: var(--kexilo-primary);
  padding: 0 2px;
  border-radius: 2px;
}

// 代码块
.code {
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 13px;
  padding: 2px 4px;
  background-color: var(--kexilo-fill-color-light);
  border: 1px solid var(--kexilo-border-color-lighter);
  border-radius: 2px;
  color: var(--kexilo-text-color-primary);
}

.code-block {
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 13px;
  padding: 12px;
  background-color: var(--kexilo-fill-color-light);
  border: 1px solid var(--kexilo-border-color-lighter);
  border-radius: var(--kexilo-border-radius-base);
  color: var(--kexilo-text-color-primary);
  overflow-x: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}

// 警告框
.alert {
  padding: 12px 16px;
  border-radius: var(--kexilo-border-radius-base);
  border-left: 4px solid;
  margin-bottom: 16px;
  
  &.alert-primary {
    background-color: var(--kexilo-primary-light-9);
    border-color: var(--kexilo-primary);
    color: var(--kexilo-primary-dark-2);
  }
  
  &.alert-success {
    background-color: var(--kexilo-success-light-9);
    border-color: var(--kexilo-success);
    color: var(--kexilo-success-dark-2);
  }
  
  &.alert-warning {
    background-color: var(--kexilo-warning-light-9);
    border-color: var(--kexilo-warning);
    color: var(--kexilo-warning-dark-2);
  }
  
  &.alert-danger {
    background-color: var(--kexilo-danger-light-9);
    border-color: var(--kexilo-danger);
    color: var(--kexilo-danger-dark-2);
  }
  
  &.alert-info {
    background-color: var(--kexilo-info-light-9);
    border-color: var(--kexilo-info);
    color: var(--kexilo-info-dark-2);
  }
}

// 面板
.panel {
  background: var(--kexilo-bg-color);
  border: 1px solid var(--kexilo-border-color-lighter);
  border-radius: var(--kexilo-border-radius-base);
  overflow: hidden;
  
  .panel-header {
    padding: 12px 16px;
    background: var(--kexilo-fill-color-light);
    border-bottom: 1px solid var(--kexilo-border-color-lighter);
    font-weight: 500;
  }
  
  .panel-body {
    padding: 16px;
  }
  
  .panel-footer {
    padding: 12px 16px;
    background: var(--kexilo-fill-color-light);
    border-top: 1px solid var(--kexilo-border-color-lighter);
  }
}

// 工具提示
.tooltip {
  position: relative;
  
  &::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  
  &:hover::after {
    opacity: 1;
  }
}
